package com.securecrt;

import org.sshbot.R;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;



public class AnimalAdapter extends ArrayAdapter {
	private static final int RESOURCE = R.layout.rowsettingbg;
	private LayoutInflater inflater;
    static class ViewHolder {
        TextView nameTxVw;
    }
	public AnimalAdapter(Context context, Background[] objects)
	{
		super(context, RESOURCE, objects);
		inflater = LayoutInflater.from(context);
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		ViewHolder holder;
		if ( convertView == null ) {
			convertView = inflater.inflate( RESOURCE, null );
			holder = new ViewHolder();
			holder.nameTxVw =(TextView) convertView.findViewById(R.id.namebg);
			convertView.setTag( holder );
		}  else {
			holder = (ViewHolder) convertView.getTag();
		}
		Background cat = (Background) getItem( position );
		if ( cat == null ) {
		}
		holder.nameTxVw.setText( cat.getName() );
		holder.nameTxVw.setCompoundDrawables( cat.getImg(), null, null, null );
		return convertView;
	}
}
class Background {
	private String   _name;
	private Drawable _img;
	private int _id;

	public Background( String name, Drawable img, int id) {
		_name = name;
		_img = img;
		_id=id;
	}
	public String getName() {
		return _name;
	}
	public Drawable getImg() {
		return _img;
	}
	public int get_id() {
		return _id;
	}
}